﻿using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 序列化数据二进制
/// </summary>
[System.Serializable]
public class SFSerializdataBinary : AbsSFSerializdata
{
    /// <summary>
    /// 存储数据
    /// </summary>
    [SerializeField]
    List<byte> mBuffer = new List<byte>();

    /// <summary>
    /// OnReadyDeserialize
    /// </summary>
    protected sealed override void OnReadyDeserialize()
    {
        OnRunReadyDeserialize(mBuffer);
    }

    /// <summary>
    /// 读取序列化数据
    /// </summary>
    /// <param name="_buffer">序列化数据</param>
    protected virtual void OnRunReadyDeserialize(List<byte> _buffer) { }

    /// <summary>
    /// 读取序列化数据
    /// </summary>
    /// <param name="_buffer">序列化数据</param>
    protected virtual void OnRunReadyDeserializeArray(List<List<byte>> _buffer) { }

    /// <summary>
    /// OnSaveSerialize
    /// </summary>
    protected sealed override void OnSaveSerialize()
    {
        mBuffer.Clear();
        OnRunSaveSerialize(mBuffer);
    }

    /// <summary>
    /// 保存序列化数据
    /// </summary>
    /// <param name="_buffer">序列化数据</param>
    protected virtual void OnRunSaveSerialize(List<byte> _buffer) {  }
}